#include<iostream>
#include<vector>
#include<queue>
#include<string>
using namespace std;
class Solution {
private:
    priority_queue<int,vector<int>,greater<int>> pri_q;//小顶堆
    void insert_Sort(string &res,int len){
        int i;
        for(i=1;i<len&&res[i]<=res[0];i++);
        if(i==len){
            res=to_string(0);
        }else{
            res.replace(0,1,1,res[i]);//replace不适用于char类型，to_string(char)会变成char的ASCII值
            res.replace(i,1,to_string(0));
        }
        
    }
public:
    string minNumber(vector<int>& nums) {
        string res;
        for(vector<int>::iterator it=nums.begin();it!=nums.end();it++){
            int x=*it;
            if(x==0)
                pri_q.push(x);
            while(x){
                pri_q.push(x%10);
                x=x/10;
            }  
        }
        while(!pri_q.empty()){
            res.append(to_string(pri_q.top()));
            pri_q.pop();
        }
        if(res[0]=='0'){
            insert_Sort(res,res.size());
        }
        
        return res;
    }
};
int main(){
    Solution s;
    vector<int> ve={10,2};
    printf("%s",s.minNumber(ve));
    return 0;
}